<?php
/**
 * Zikula Application Framework
 *
 * @copyright (c) 2004, Zikula Development Team
 * @link http://www.zikula.org
 * @version $Id: function.selector_object_array_ex.php,v 1.3 2011/02/26 05:38:41 parinya Exp $
 * @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
 * @author Robert Gasch
 * @package Zikula_Template_Plugins
 * @subpackage Functions
 */

function smarty_function_getRoomList ($params, &$smarty)
{
    if(!pnUserLoggedIn()){
      return LogUtil::registerError ("You are not Logged in.");
    }
    
    $uid = SessionUtil::getVar('uid');
   
    if (!($class = Loader::loadClassFromModule ('HotelBooking',"Userhotelmember", false)))
        return LogUtil::registerError ("Unable to load class [UserHotelMember] ...");
        
    $object  = new $class ();
    $where = $object->_columns['cr_uid']."  = ".$uid;
    $object->getWhere($where);
    if(count($object->_objData)<=0){
      $hotelId = FALSE;
    }else{
      $hotelId = $object->_objData[id];
    }
    
    unset($object);
    unset($where);
    unset($object);
    
    if (!($class = Loader::loadClassFromModule ('HotelBooking',"Userhotelroom", TRUE)))
        return LogUtil::registerError ("Unable to load class [Userhotelroom] ...");
    
    $object  = new $class ();
    $where = $object->_columns['cr_uid']."  = ".$uid;
    $object->getWhere($where);
    if(count($object->_objData)<=0){
      $smarty->assign("roomList",FALSE);
    }else{
      $smarty->assign("roomList",$object->_objData);
    }
    
}
